This invention relates to data compression, a control program for controlling the data compression, and a computer-readable storage medium for storing the control program. In particular, this invention relates to a data compression device and method for use in the data compression.
A conventional data compression device of the type described has been exemplified in Japanese Unexamined Patent Publication No. Hei 6-311369 (namely, 311369/1994) that will be simply called Reference 1. The data compression device described in Reference 1 is used for an image coding device that is given a sequence of quantized image signals as input data signals and that carries out data compression processing.
More specifically, the data compression device has first through third Huffman coders that carry out data compression by the use of different Huffman coding tables and that are previously given identification codes. One of the first through the third Huffman coders that produces or outputs a minimum code amount of Huffman codes is selected as a selected coder by a code selector. The Huffman codes compressed by the selected coder are produced together with the corresponding identification code assigned to the selected coder. In other words, combinations of the Huffman codes and the corresponding identification codes are successively produced from the data compression device disclosed in Reference 1.
When data compression processing is repeated many times in a manner as mentioned before, a code amount of identification codes is excessively increased, which brings about deterioration of coding efficiency.
In order to reduce a code amount of the identification codes, using a run length code has been recommended so as to generate the Identification codes in MPEG-2 AAC which is prescribed in connection with an audio signal by the International standard organization. As regards the MPEG-2 AAC standard, detailed description is made in Information Technology-Generic coding of moving pictures and associated audio, Part 7: (Advanced Coding AAC).
Now, description will be made about a method of generating the identification codes in accordance with MPEG-2AAC. In the MPEG-2AAC, each of the Huffman coders, such as each of the first through the third Huffman coders mentioned above, can be distinguished from one another so as to identify the selected coder by using numerals from one to fifteen as the identification codes. In other words, each Huffman coder is identified by each of the numerals. Each numeral that specifies the corresponding Huffman coder is generated in the form of an identification value. Such an identification value is successively generated each time when the selected coder is determined.
Specifically, it is assumed that the first through the third Huffman coders are given the numerals “0”, “1”, and “2”, as the identification values, respectively. In this event, when the first, the second, and the third Huffman coders are successively selected as the selected coder in order, the identification values “0”, “1”, and “2” are successively produced from the code selector. Practically, a plurality of the identification values are combined or collected together and subjected to run length coding to be coded into the identification codes.
For example, it is surmised that the identification values are represented by a series of “0,0,0,2,2,1,1,1,1” that is divided into a string of “0”, a string of “2”, and a string of “1”. More specifically, the string of “0” lasts for three times (will be called “3” run) while the strings of. “2” and “1” last for two times (“2” run) and four times (“4” run), respectively. Since each identification value and its concatenation is encoded by the run length coding, the above-mentioned identification values are encoded into the identification code of “0,3, 2, 2, 1, 4”.
In the above-mentioned MPEG-2AAC, the identification value and the run of each identification code are represented by four bits and five bits, respectively. According to the MPEG-2AAC, the series of “0,0,0,2,2,1,1,1,1” is encoded into “0,3,2,2,1,4” that can be represented by:(4 (bits)+5 (bits))×3=27 (bits).
On the other hand, when each identification value of the above-mentioned series of “0,0,0,2,2,1,1,1,1” is encoded by four bits, 36 bits (=4×9) are required to encode the whole of the series.
From this fact, it is readily understood that a code amount can be reduced by carrying out encoding operation in accordance with the MPEG-2AAC.
However, such a reduction of a code amount can be accomplished only when the same numerals or identification values are continued a lot. For example, let a series of the identification values be “0,1,0,2,1,2,0,1,2”. In this case, when each identification value is encoded by four bits, the whole of the series can be encoded by 36 bits (=4 (bits)×9). On the other hand, the run length coding needs 81 bits (=(4 bits+5 bits)×9).
This means that the above-mentioned method is bad in compression ratio and large in code amount because the identification code is not efficiently coded which identifies the selected Huffman coder.